home *** CD-ROM | disk | FTP | other *** search
- #include <ListMgr.h>
- #include <WindowMgr.h>
- #include <MacTypes.h>
- #include <QuickDraw.h>
-
- #include "MacCalc.h"
- #include "SheetHndlg.h"
-
- int DrawGrid( win_ptr )
- WindowPtr win_ptr ;
- {
- GrafPtr tmp_port ;
- Rect win_rect ;
- int bottom ;
- int right ;
- int num_h_lines ;
- int num_v_lines ;
- int i, max ;
-
- GetPort( &tmp_port ) ;
- SetPort( win_ptr ) ;
-
- PenNormal( ) ;
- PenPat( gray ) ;
-
- win_rect = win_ptr->portRect ;
- bottom = win_rect.bottom - 15 ;
- right = win_rect.right - 15 ;
- num_h_lines = bottom / CELL_HEIGTH ;
- num_v_lines = right / CELL_WIDTH ;
-
- max = ( num_h_lines > num_v_lines ) ? num_h_lines:num_v_lines ;
-
- for( i = 1 ; i <= max ; i++ ) {
- if( i < num_h_lines ) {
- MoveTo( 0, i*CELL_HEIGTH ) ;
- LineTo( right, i*CELL_HEIGTH ) ;
- }
- if( i < num_v_lines ) {
- MoveTo( i*CELL_WIDTH, 0 ) ;
- LineTo( i*CELL_WIDTH, bottom ) ;
- }
- }
- PenNormal( ) ;
- SetPort( tmp_port ) ;
- return ;
- }